#!/usr/bin/env python
# -*- coding: utf-8 -*-
#  question_response_worker.py
#  description

#  Created by zhouzongli633 on 2020/8/11 5:09 下午.
#  Copyright ©Intellectus All rights reserved.

from Common.logger import gen_log
import pytz
import datetime

def perform(user_id, baby_id, q_id, answer, final_discharge=None):
    gen_log.info("QuestionResponseWorker started...")
    gen_log.info("user_id:{} baby_id:{} q_id:{} answer:{}".format(user_id, baby_id, q_id, answer))
    if not user_id or not baby_id or not answer:
        return
    # @zone = ActiveSupport::TimeZone.new('Central Time (US & Canada)')
    # @time_now = Time.now
    # @start_time = @time_now.in_time_zone(@zone)
    # @todays_date = @start_time.in_time_zone(@zone).to_date
    # @interval = (@start_time.end_of_day - @start_time).to_i
    tz = pytz.timezone('America/New_York')
    time_now = datetime.datetime.now()
    start_time = time_now.astimezone(tz)
    todays_date = start_time.date()
    interval = start_time